package cn.kingyang.yiyi.mvp.presenter;

import java.util.List;

import cn.kingyang.yiyi.mvp.model.bean.HttpData;
import cn.kingyang.yiyi.mvp.model.bean.NobleVideo;
import cn.kingyang.yiyi.mvp.model.biz.AppModel;
import cn.kingyang.yiyi.mvp.view.SearchView;
import io.reactivex.functions.Consumer;

/**
 * Created by Administrator on 2017/3/11.
 */

public class SearchPresenter extends BasePresenter<SearchView> {
    private AppModel appModel;

    public SearchPresenter() {
        appModel = new AppModel();
    }

    public void search(String title) {
        getView().showProgress();
        addDisposable(appModel.Search(title), new Consumer<HttpData<List<NobleVideo>>>() {
            @Override
            public void accept(HttpData<List<NobleVideo>> httpData) throws Exception {
                getView().dosearch(httpData);
            }
        });
    }
}
